home *** CD-ROM | disk | FTP | other *** search
- /* Used to remove the style from any text that is in the scrap. */
- /* Written by Thomas A. S. Nielsen. */
- /* No copyright what-so-ever! */
-
- Handle NewClearSysHandle(long size){ /* the function name says it all */
- asm{
- move.l size,d0
- NewHandle CLEAR+SYS
- move.l a0,d0
- }
- }
-
- void main(void){
- long scrapsize, offset;
- Handle h;
-
- scrapsize=0L;
- h=0L;
-
- if (!(h=NewClearSysHandle(0))) /* Get scrap will resize our Handle below */
- goto returnpoint; /* not enough memory, could beep */
- scrapsize=GetScrap(h,'TEXT',&offset); /* get the clipboard tex t*/
- if (scrapsize>0){
- SetHandleSize(h,scrapsize+(scrapsize&1)); /* make sure handle size if even (read somewhere) */
- ZeroScrap(); /* clear out all rsrc from scrap */
- PutScrap(scrapsize,'TEXT',*h); /* put text back */
- SystemEdit(3); /* this is the TRICK, it took me forever to figure this out. */
- }
-
- returnpoint: /* clean up */
- if (h)
- DisposHandle(h);
- }
-